package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.INewStatisticsDao;
import org.jsbd.boss.domian.NewStatisticsBean;
import org.jsbd.boss.domian.TaskHandlerSh;
import org.jsbd.boss.domian.statistics.AddStatisticsVo;
import org.springframework.stereotype.Repository;

@Repository("newStatisticsDao")
public class NewStatisticsDaoImpl extends CrackBaseDao implements INewStatisticsDao {

	@Override
	public void saveNewTotalNumInfo(List<NewStatisticsBean> statisticsList) {
		super.batchUpdate("qy_channel_add_statistics.update_qy_channel_add_statistics_totalNum",
				statisticsList);
	}

	@Override
	public Map<String, Object> getNewTaskPageList(DataGridModel page, TaskHandlerSh form) {
		form = (form == null ? new TaskHandlerSh() : form);
		form.setPageInfo(page);
		Map<String, Object> results = new HashMap<String, Object>();
		results.put("total", super.queryForCount("qy_channel_add_statistics.select_qy_channel_add_statistics_page_count", form));
		results.put("rows", super.queryForList("qy_channel_add_statistics.select_qy_channel_add_statistics_list", form));
		return results;
	}

	@Override
	public Map<String, Object> getNewTaskPageMonthList(DataGridModel page, TaskHandlerSh taskHandlerSh) {
		taskHandlerSh = (taskHandlerSh == null ? new TaskHandlerSh() : taskHandlerSh);
		taskHandlerSh.setPageInfo(page);
		Map<String, Object> results = new HashMap<String, Object>();
		results.put("total", super.queryForCount("qy_channel_add_statistics.select_qy_channel_add_statistics_month_count", taskHandlerSh));
		results.put("rows", super.queryForList("qy_channel_add_statistics.select_qy_channel_add_statistics_month_list", taskHandlerSh));
		return results;
	}

	@Override
	public Integer selectAddStatisticsCount(AddStatisticsVo addStatisticsVo) {
		return  super.queryForCount("qy_channel_add_statistics.select_add_statistics_list_count", addStatisticsVo);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<AddStatisticsVo> selectAddStatisticsList(AddStatisticsVo addStatisticsVo) {
		return super.queryForList("qy_channel_add_statistics.select_add_statistics_list", addStatisticsVo);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<AddStatisticsVo> getAllStatisticsList(Map<String, Object> param) {
		return super.queryForList("qy_channel_add_statistics.select_add_statistics_list_all_by_condition", param);
	}

	@Override
	public void insertStatistics(List<AddStatisticsVo> insertList) {
		super.batchInsert("qy_channel_add_statistics.insert_add_statistics_list_all_by_condition", insertList);
	}

	
	
}
